package com.wtwd.campus.receiver;

import com.wtwd.campus.entity.MqGeneralValueResult;
import com.wtwd.campus.service.IRMFeignClientService;
import com.wtwd.campus.service.InjectFeignService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author mjy
 * @date 2022/07/08
 * @description
 */
public class GetLtAuthKeyReceiver implements Receiver {

    //    *WT,MEID,GETLTAUTHKEY,HHMMSS,DATE,STATUS#
    @Autowired
    private IRMFeignClientService irmFeignClientService;


    @Override
    public String parseMessage(String data) {
        String[] split = data.split(",");
        String imei = split[1];
        String messageType = split[2];
        String commandNumber = split[3];
        String deviceDate = split[4];
        String deviceStatus = split[5];
        MqGeneralValueResult mqGeneralValueResult = new MqGeneralValueResult();
        mqGeneralValueResult.setImei(imei);
        mqGeneralValueResult.setCommandNumber(commandNumber);
        mqGeneralValueResult.setDeviceStatus(deviceStatus);
        mqGeneralValueResult.setDeviceDate(deviceDate);
        mqGeneralValueResult.setDeviceTime(commandNumber);
        InjectFeignService.getIrmFeignClientService().getLtAuthKey(mqGeneralValueResult);
        return imei;
    }


}
